public class ImageDemo extends java.applet.Applet {
    private java.awt.Image image;
    private java.applet.AppletContext context;

    @Override
    public void init() {
        super.init();
        context = this.getAppletContext();
        String imageURL = this.getParameter("image");

        if (imageURL == null) {
            imageURL = "java.jpg";
        }

        try {
            java.net.URL url = new java.net.URL(this.getDocumentBase(), imageURL);
            image = context.getImage(url);
        } catch (java.net.MalformedURLException e) {
            e.printStackTrace();
            // Display in browser status bar
            context.showStatus("Could not load image!");
//            throw new RuntimeException(e);

        }


    }


    @Override
    public void paint(java.awt.Graphics g) {
        super.paint(g);
        context.showStatus("Displaying image");
        g.drawImage(image, 0, 0, 200, 84, null);
        g.drawString("www.javalicense.com", 35, 100);
    }
}
